﻿using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using Budjelar.Model.Entities;

namespace Budjelar.Repository.EF.Configuration
{
    public class StavkaRacunaConfiguration : EntityTypeConfiguration<StavkaRacuna>
    {
        public StavkaRacunaConfiguration()
        {
            ToTable("StavkeRacuna");
            HasKey(x => x.RedniBroj);
            Property(x => x.RedniBroj).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            HasRequired(x => x.Artikal).WithMany().HasForeignKey(x => x.IdArtikla);
            HasRequired(x => x.Racun).WithMany().HasForeignKey(x => x.IdRacuna);
            Property(x => x.Kolicina).HasPrecision(6, 2);
            Property(x => x.Cena).HasPrecision(8, 2);
            Property(x => x.Iznos).HasPrecision(8, 2);
        }
    }
}